<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * @property int $deletetime
 * @property int $id
 * @property int $order_id 订单
 * @property int $score 评分（最大5分）
 * @property int $spot_id 景点
 * @property int $user_id 用户
 * @property string $content 内容
 * @property string $createtime
 * @property string $day 何时来过
 * @property string $images 图片
 * @property string $title 标题
 * @property string $type 类型
 * @property-read \app\model\User $user
 * @property-read mixed $images_text
 * @method static \think\db\Query onlyTrashed()
 * @method static \think\db\Query withTrashed()
 * @mixin \think\Model
 */
class LineOrdersAssess extends Model
{
	use SoftDelete;
	//
	protected $createTime = 'createtime';
	protected $deleteTime = 'deletetime';
	
	protected $append = [
		'images_text'
	];
	
	function user()
	{
		return $this->belongsTo(User::class,'user_id');
	}
	
	function getImagesTextAttr($value,$data)
	{
		$value = $value ?? ($data['images'] ?? '');
		return $value?explode(',', $value):[];
	}
}
